home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / fly.h < prev    next >
C/C++ Source or Header  |  1979-12-31  |  20KB  |  836 lines

  1. /* --------------------------------- fly.h ---------------------------------- */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* structures used by the system.
  8. */
  9.  
  10. #ifndef FLY8_FLY
  11. #define FLY8_FLY
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <ctype.h>
  17. #include <stdarg.h>
  18.  
  19. #ifndef LOCAL_FUNC
  20. #define LOCAL_FUNC    static
  21. #endif
  22.  
  23. #include "config.h"
  24. #include "keymap.h"
  25. #include "shape.h"
  26. #include "objects.h" 
  27. #include "stats.h"
  28. #include "colors.h"
  29.  
  30. #define rangeof(array)    (sizeof(array)/sizeof(array[0]))
  31.  
  32. #define    BUFLEN    256        /* size of a display list block */
  33.  
  34. typedef unsigned char    Uchar;
  35. typedef unsigned int    Uint;
  36. typedef unsigned short    Ushort;
  37. typedef unsigned long    Ulong;
  38.  
  39. typedef short    ANGLE;
  40. typedef short    VECT[3];
  41. typedef long    LVECT[3];
  42. typedef ANGLE    AVECT[3];
  43. typedef short    MAT[3][3];
  44.  
  45. #define X    0
  46. #define Y    1
  47. #define Z    2
  48.  
  49. #define    HEAD    0
  50. #define    TAIL    1
  51.  
  52. #define QUEUE(q,m) \
  53.     if ((q)[HEAD])            \
  54.         (q)[TAIL]->next = (m);    \
  55.     else                \
  56.         (q)[HEAD] = (m);    \
  57.     (q)[TAIL] = (m)
  58.  
  59. typedef struct vertex    VERTEX;
  60. typedef struct shape    SHAPE;
  61. typedef struct object    OBJECT;
  62. typedef Ushort        BUFLINE;
  63. typedef struct buffer    BUFFER;
  64. typedef struct device    DEVICE;
  65. typedef struct pointer    POINTER;
  66. typedef struct screen    SCREEN;
  67. typedef struct view    VIEW;
  68. typedef struct window    WINDOW;
  69. typedef struct viewport    VIEWPORT;
  70. typedef struct player    PLAYER;
  71. typedef struct packet    PACKET;
  72. typedef struct netport    NETPORT;
  73. typedef struct msg    HMSG;
  74. typedef struct hdd    HDD;
  75. typedef struct pid    PID;
  76. typedef struct macro    MACRO;
  77. typedef struct menu    MENU;
  78.  
  79. struct vertex {
  80.     VECT    V;
  81.     Ushort    flags;
  82. };
  83.  
  84. struct shape {
  85.     VERTEX    *v;
  86.     Ushort    extent;
  87.     Ushort    flags;
  88.     long    weight;        /* grams */
  89.     short    drag;        /* drag factor */
  90.     Ushort    color;
  91. };
  92.  
  93. #define    SH(p)        (st.bodies[p->name]->shape)
  94. #define TITLE(p)    (st.bodies[p->name]->title)
  95.  
  96. struct pid {
  97.     long    Kp;
  98.     long    Iband;
  99.     long    Ki;
  100.     long    Dband;
  101.     long    Kd;
  102.     long    factor;
  103.     long    range;
  104.     long    Pprev;
  105.     long    I;
  106. };
  107.  
  108. struct macro {
  109.     Ushort    name;
  110. #define KEYUNUSED        0
  111.     Ushort    len;
  112.     Ushort    *def;
  113. };
  114.  
  115. struct menu {
  116.     int    letter;
  117.     char    *text;
  118. };
  119.  
  120. typedef struct e_imported E_IMPORT;
  121. struct e_imported {
  122.     Ulong    lasttime;
  123.     Ulong    timeout;
  124.     short    misc[5];
  125. };
  126.  
  127. #define EIM(p)    (*(E_IMPORT **)&(p)->extra)
  128.  
  129.  
  130. struct object {
  131.     OBJECT        *next;
  132.     OBJECT        *prev;
  133.     void        *extra;
  134.     OBJECT        *owner;
  135.     PLAYER        *rplayer;
  136.     POINTER        *pointer;
  137.     VIEWPORT    *viewport;
  138.     long        id;        /* local object id */
  139.     long        rid;        /* remote object id */
  140.     long        ownerid;    /* local object id of owner-object */
  141.     Ulong        rtime;        /* remote time */
  142.     Ulong        tob;        /* time of birth */
  143.     Ulong        tom;        /* time of maturity */
  144.     LVECT        R;        /* position [earth] */
  145.     VECT        V;        /* velocity [earth] */
  146.     AVECT        dda;        /* angular accels [body] */
  147.     AVECT        da;        /* angular rates [body] */
  148.     AVECT        dae;        /* Euler rates [earth] */
  149.     AVECT        a;        /* Euler angles [earth] */
  150.     short        sinx;
  151.     short        cosx;
  152.     short        siny;
  153.     short        cosy;
  154.     short        sinz;
  155.     short        cosz;
  156.     MAT        T;        /* body->earth xform matrix */
  157.     short        home;        /* home ils beacon id */
  158.     short        longitude;
  159.     short        longmin;
  160.     short        latitude;
  161.     short        latmin;
  162.     short        name;
  163.     Ushort        color;
  164. #define    FOREVER        0x7fff
  165.     short        time;
  166. #define    TIMEPSEC    100
  167.     Ushort        flags;
  168. #define F_VISIBLE    0x0001        /* permanent: */
  169. #define F_IMPORTED    0x0002
  170. #define F_EXPORTED    0x0004
  171. #define F_MAINT        0x0008
  172. #define F_STEALTH    0x0010
  173. #define F_CC        0x0020
  174. #define F_LAND        0x0040        /* part of landscape */
  175. #define F_FRIEND    0x0080
  176. #define F_ALIVE        0x0200        /* transitional: */
  177. #define F_NEW        0x0400
  178. #define F_DEL        0x0800
  179. #define F_HIT        0x1000
  180. #define F_KEEPNAV    0x2000
  181. #define F_DONE        0x4000
  182. #define F_MOD        0x8000
  183.     Ushort        gpflags;
  184. #define GPF_PILOT    0x0001
  185.     Ushort        shflags;    /* copy of SH flags */
  186.     short        speed;
  187.     short        e_type;
  188. #define ET_IMPORTED    0x0001
  189. #define ET_PLANE    0x0002
  190. #define ET_BOMB        0x0003
  191. #define IS_PLANE(p)    (ET_PLANE == (p)->e_type)
  192.     short        score;
  193.     short        damage;
  194.     short        damaging;
  195.     short        misc[5];
  196. };
  197.  
  198. struct buffer {
  199.     BUFFER        *next;
  200.     BUFLINE        *p;        /* first free */
  201.     BUFLINE        first[1];    /* start of data array */
  202. };
  203.  
  204. #define    T_MASK        0xe000U
  205. #define    T_BIT        0x2000U
  206. #define    T_COLOR        (0 * T_BIT)
  207. #define    T_DRAW        (1 * T_BIT)
  208. #define    T_MOVE        (2 * T_BIT)
  209. #define    T_ELLIPSE    (3 * T_BIT)
  210. #define    T_MODE        (4 * T_BIT)
  211. #define    T_NOP        (7 * T_BIT)
  212. #define    T_MOR        0U
  213. #define    T_MXOR        1U
  214. #define    T_MSET        2U
  215.  
  216. struct device {
  217.     DEVICE    *next;
  218.     char    *name;
  219.     void    *pdevice;    /* private device data */
  220.     int    mode;        /* vga bios mode etc. */
  221.     int    colors;        /* number of colors */
  222.     int    minx;        /* physical */
  223.     int    miny;        /* physical */
  224.     int    sizex;        /* physical */
  225.     int    sizey;         /* physical */
  226.     int    npages;        /* how many display pages */
  227.     int    lengx;        /* millimeter */
  228.     int    lengy;        /* millimeter */
  229.     int    flags;        /* driver dpivate */
  230. };
  231.  
  232. struct pointer {
  233.     char    *name;
  234.     Ushort    flags;
  235. #define PF_PRESENT    0x0001
  236. #define PF_INITED    0x0002
  237.     struct PtrDriver NEAR* control;
  238. #define    NANALOG    10
  239. /* Channel allocation:
  240.  * 0    roll clockwise
  241.  * 1    pitch up
  242.  * 2    rudder right
  243.  * 3    throttle
  244.  * 4    trim pitch up
  245.  * 5    trim rudder right
  246.  * 6    flaps
  247.  * 7    spoilers
  248.  * 8    speed brakes
  249.  * 9    ground brakes
  250. */
  251.     short    a[NANALOG];    /* analog -100...+100 */
  252.     short    l[NANALOG];    /* last value of a[] */
  253.     Ushort    low[NANALOG];    /* calibration */
  254.     Ushort    c[NANALOG];    /* calibration */
  255.     Ushort    high[NANALOG];    /* calibration */
  256.     Ushort    play[NANALOG];    /* calibration */
  257.     short    b[10];        /* digital commands */
  258.     Ushort    btn[36];    /* buttons flags */
  259. #define    NOPTS    20
  260.     int    opt[NOPTS];
  261. };
  262.  
  263. struct screen {
  264.     DEVICE    *device;
  265.     void    *pscreen;    /* private screen data */
  266.     short    minx;        /* physical */
  267.     short    miny;        /* physical */
  268.     short    sizex;        /* physical */
  269.     short    sizey;        /* physical */
  270.     Ushort    FgColor;
  271.     Ushort    BgColor;
  272.     Ushort    BoColor;    /* border */
  273. };
  274.  
  275. struct window {
  276.     int    orgx;    /* all in normalized coordinates [0...1] */
  277.     int    orgy;
  278.     int    maxx;    /* left=orgx-maxx right =orgx+maxx */
  279.     int    maxy;    /* top =orgy-maxy bottom=orgy+maxy */
  280. };
  281.  
  282. struct viewport {
  283.     Ushort    flags;
  284. #define    VF_MIRROR    0x0001
  285.     int    x;    /* NDC normally 0.0 */
  286.     int    y;    /* NDC normally 0.0 */
  287.     int    z;    /* NDC zoom, normally 0.5, must >= maxx and maxy! */
  288.     int    maxx;    /* NDC vp width normally 0.5 */
  289.     int    maxy;    /* NDC vp height normally 0.5 */
  290.             /* distz and shift in units of VONE*VONE */
  291.     int    distz;    /* eye to vp in viewers coords */
  292.     int    shift;    /* eye x shift (v coords) in stereo */
  293.     int    eyex;    /* viewer coords: */
  294.     int    eyey;    /* eye position relative to viewer object origin */
  295.     int    eyez;
  296.     ANGLE    rotx;    /* eye direction relative to viewer origin */
  297.     ANGLE    roty;
  298.     ANGLE    rotz;
  299.     int    zoom;    /* zoom count */
  300. };
  301.  
  302. struct    view {
  303.     VIEWPORT    *viewport;    /* camera: world -> 2D */
  304.     WINDOW        *window;    /* camera -> NDC window */
  305.     SCREEN        *screen;    /* window -> physical screen */
  306. };
  307.  
  308. typedef struct body BODY;
  309. struct body {
  310.     int    name;
  311.     Ushort    flags;
  312. #define BO_DYNSHAPE    0x0001
  313.     char    *title;
  314.     SHAPE    *shape;
  315.     int    (FAR* init) (BODY *b);
  316.     void    (FAR* term) (BODY *b);
  317.     int    (FAR* create) (OBJECT *object);
  318.     void    (FAR* delete) (OBJECT *object);
  319.     void    (FAR* dynamics) (OBJECT *object, int interval);
  320.     void    (FAR* hit) (OBJECT *object, int speed, int extent,
  321.             int damaging);
  322. };
  323.  
  324. #define    LADDRESS    6
  325. #define    LNAME        20
  326.  
  327. struct player {
  328.     PLAYER    *next;
  329.     Ushort    flags;
  330. #define    PL_ACTIVE    0x0001
  331. #define    PL_PENDREQUEST    0x0002
  332. #define    PL_PENDBOSS    0x0004
  333. #define    PL_PENDCONFIRM    0x0008
  334. #define    PL_PEND    (PL_PENDREQUEST|PL_PENDCONFIRM|PL_PENDBOSS)
  335. #define    PL_PLAYING    0x0010
  336. #define    PL_RECEIVE    (PL_PENDCONFIRM|PL_PLAYING)
  337. #define    PL_SEND    (PL_PLAYING)
  338. #define    PL_NOTIDLE    (PL_ACTIVE|PL_PEND|PL_PLAYING)
  339. #define    PL_FRIEND    0x0020
  340.     short    netport;
  341.     Uchar    address[LADDRESS];
  342.     char    name[LNAME];
  343.     char    team[LNAME];
  344.     short    ComVersion;            /* net version */
  345.     PACKET    *incoming;
  346.     PACKET    *tail;
  347.     Ulong    timeout;
  348.     long    rtime;                /* RemoteTime-LocalTime */
  349.     short    rtimeErr;            /* intergrated error */
  350. };
  351.  
  352. struct netport {
  353.     Ushort            flags;
  354. #define    NP_ON        0x0001
  355. #define    NP_BCAST    0x0002
  356. #define    NP_PACKING    0x0004
  357.     Ushort            packlen;
  358.     short            netport;
  359.     char            unit;
  360.     int            nplayers;    /* playing users */
  361.     struct NetDriver    *NetDriver;
  362.     PACKET            *incoming[2];
  363.     PACKET            *outgoing;    /* async send */
  364.     PACKET            *outpak;    /* packed packet */
  365. };
  366.  
  367. #define    PAKPACKLEN    1500            /* max pack len */
  368.  
  369. struct packet {
  370.     PACKET    *next;        /* must be first! */
  371.     Uchar    *data;        /* acquired packet data memory */
  372.     Uchar    *address;    /* where address is in 'data' */
  373.     Uchar    *raw;        /* where real packet starts in 'data'*/
  374.     Ulong    arrived;    /* arrival time */
  375.     Ushort    flags;        /* running length if incomming */
  376.     short    netport;
  377.     short    length;        /* message length */
  378.     Ushort    size;        /* raw data size */
  379. };
  380.  
  381. struct SysDriver {
  382.     char    *name;
  383.     Ushort    flags;
  384.     void    *extra;
  385.     int    (FAR* Init) (void);
  386.     void    (FAR* Term) (void);
  387.     void    (FAR* Poll) (void);
  388.     Ulong    (FAR* Disable) (void);
  389.     void    (FAR* Enable) (Ulong i);
  390.     void    (FAR* Shell) (void);
  391.     void    (FAR* BuildFileName) (char *FullName, char *path, char *name,
  392.                     char *ext);
  393. };
  394.  
  395. struct TmDriver {
  396.     char    *name;
  397.     Ushort    flags;
  398.     void    *extra;
  399.     int    (FAR* Init) (char *options);
  400.     void    (FAR* Term) (void);
  401.     Ulong    (FAR* Milli) (void);
  402.     int    (FAR* Hires) (void);
  403.     char *    (FAR* Ctime) (void);
  404.     Ulong    (FAR* Interval) (int mode, Ulong res);
  405. #define TMR_PUSH    0x0001
  406. #define TMR_POP        0x0002
  407. #define TMR_READ    0x0004
  408. #define TMR_SET        0x0008
  409. #define    TMR_START    (TMR_PUSH|TMR_SET)
  410. #define TMR_STOP    (TMR_READ|TMR_POP)
  411. #define TMR_RESTART    (TMR_READ|TMR_SET)
  412. };
  413.  
  414. struct KbdDriver {
  415.     char    *name;
  416.     Ushort    flags;
  417.     void    *extra;
  418.     int    (FAR* Init) (char *options);
  419.     void    (FAR* Term) (void);
  420.     int    (FAR* Read) (void);
  421.     int    (FAR* Getch) (void);
  422.     int    (FAR* Wait) (void);
  423. };
  424.  
  425. struct SndDriver {
  426.     char    *name;
  427.     Ushort    flags;
  428.     void    *extra;
  429.     int    (FAR* Init) (char *options);
  430.     void    (FAR* Term) (void);
  431.     void    (FAR* Poll) (int force);
  432.     int     (FAR* Beep) (int f, int milli);
  433.     int     (FAR* Effect) (int eff, int command, ...);
  434. #define EFF_HIT            1    /* eff */
  435. #define EFF_M61_SHOOT        2
  436. #define EFF_MK82_EXPLODE    3
  437. #define EFF_MK82_SHOOT        4
  438. #define EFF_NO_POINTER        5
  439. #define EFF_BEEP        6
  440. #define EFF_MSG            7
  441. #define EFF_ENGINE        8
  442. #define EFF_GONE        9
  443. #define EFF_HELLO        10
  444. #define EFF_NOTICE        11
  445. #define EFF_GEAR        12
  446. #define EFF_ALARM        13
  447. #define EFF_WARN        14
  448. #define EFF_DAMAGE        15
  449. #define SND_OFF            0    /* command */
  450. #define SND_ON            1
  451. #define SND_PARMS        2
  452.     int     (FAR* List) (int *list, int command);
  453. };
  454.  
  455. struct GrDriver {
  456.     char    *name;
  457.     Ushort    flags;
  458.     void    *extra;
  459.     DEVICE    *devices;
  460.     int    (FAR* Init) (DEVICE *dev, char *options);
  461.     void    (FAR* Term) (DEVICE *dev);
  462.     void    (FAR* MoveTo) (Uint x1, Uint y1);
  463.     void    (FAR* DrawTo) (Uint x2, Uint y2, Uint c);
  464.     int    (FAR* SetVisual) (int page);
  465.     int    (FAR* SetActive) (int page);
  466.     void    (FAR* Clear) (SCREEN *scr);
  467.     int    (FAR* SetWriteMode) (int mode);
  468.     int    (FAR* SetPalette) (int index, long color);
  469.     void    (FAR* Ellipse) (Uint x, Uint y, Uint rx, Uint ry, Uint c);
  470.     void    (FAR* Flush) (void);
  471.     int    (FAR* Shutters) (int eye);
  472. };
  473.  
  474. struct PtrDriver {
  475.     char    *name;
  476.     Ushort    flags;
  477.     void    *extra;
  478.     int    (FAR* Init) (POINTER *p, char *options);
  479.     void    (FAR* Term) (POINTER *p);
  480.     int    (FAR* Cal) (POINTER *p);
  481.     int    (FAR* Center) (POINTER *p);
  482.     int    (FAR* Read) (POINTER *p, int transfer);
  483.     void    (FAR* Key) (POINTER *p, int key);
  484. };
  485.  
  486. struct NetDriver {
  487.     char    *name;
  488.     Ushort    flags;
  489.     void    *extra;
  490.     int    (FAR* Init) (NETPORT *port, char *options);
  491.     void    (FAR* Term) (NETPORT *port);
  492.     int    (FAR* Send) (NETPORT *port, PACKET *pack);
  493.     int    (FAR* Poll) (NETPORT *port);
  494. };
  495.  
  496. struct netname {
  497.     struct netname    *next;
  498.     char        *name;
  499. };
  500.  
  501. struct msg {
  502.     HMSG        *next;
  503.     char        *text;
  504.     Ulong        timeout;    /* time to delete */
  505.     Uint        flags;
  506. #define MSG_WARN    0x0001
  507. #define MSG_ERR        0x0002
  508. };
  509.  
  510. #define NBUFS        2        /* must be 2 for now */
  511.  
  512. struct hdd {
  513.     short        type;
  514. #define    HDT_FRONT     0
  515. #define    HDT_NONE     1
  516. #define    HDT_REAR     2
  517. #define    HDT_MAP         3
  518. #define    HDT_RADAR     4
  519. #define    HDT_TARGET     5
  520. #define    HDT_PAN         6
  521. #define    HDT_GAZE     7
  522. #define    HDT_CHASE     8
  523. #define    HDT_FOLLOW     9
  524. #define    HDT_HUD        10
  525. #define    HDT_UPFRONT    11
  526. #define    HDT_PANEL    12
  527. #define    HDT_RIGHT    13
  528. #define    HDT_LEFT    14
  529. #define    HDT_STORES    15
  530. #define    HDT_LAMPS    16
  531. #define    HDT_MIRROR    17
  532.     Ushort        flags;
  533. #define HDF_ON        0x0001
  534. #define HDF_MONO    0x0002        /* monochrome */
  535.     Ushort        FgColor;
  536.     Ushort        BgColor;
  537.     Ushort        BoColor;    /* border */
  538.     VIEW        view;
  539.     BUFFER        *bufs[NBUFS];    /* HDD window */
  540. };
  541. #define NVIEWERS    10
  542.  
  543. struct status {
  544.     struct SysDriver    NEAR* system;
  545.     struct TmDriver        NEAR* time;
  546.     struct GrDriver        NEAR* graphics;
  547.     struct SndDriver    NEAR* sound;
  548.     struct KbdDriver    NEAR* keyboard;
  549.     BODY        **bodies;
  550.     char        *iname;            /* init file */
  551.     char        *mname;            /* macros file */
  552.     char        *fname;            /* font file [obsolete] */
  553.     char        *vmdname;        /* video modes file */
  554.     char        *lname;            /* log file name */
  555.     char        *navname;        /* nav file name */
  556.     char        *lndname;        /* landscape file name */
  557.     char        *fdir;            /* support files directory */
  558.     char        *ptrname;        /* pointer device name */
  559.     char        *grname;        /* video device name */
  560.     char        *grmname;        /*    and mode */
  561.     char        *sndname;        /* sound device name */
  562.     char        *kbdname;        /* keyboard device name */
  563.     struct netname    *netnames;        /* net drivers */
  564.     char        *ptype;            /* plane type */
  565.     char        *dtype;            /* drone type */
  566.     char        *options;        /* options for 'create_obj' */
  567.     char        *nikname;        /* my handle */
  568.     char        *teamname;        /* my team name */
  569.     char        *homename;        /* my nav home name */
  570.     char        *timeropts;
  571.     char        *initkeys;        /* startup keystrokes */
  572.     Ulong        big_bang;        /* keep relative time */
  573.     Ulong        present;
  574.     Ulong        lasttime;
  575. #define    TO_OBJECT    (4*1000L)
  576.     Ulong        ObjectTimeout;
  577. #define    TO_PLAYER    (8*1000L)
  578.     Ulong        PlayerTimeout;
  579. #define    TO_DRONE    (8*1000L)
  580.     Ulong        DroneTime;        /* drone takeoff delay */
  581. #define    TO_REFRESH    (TO_OBJECT/4)
  582.     Ulong        RefreshTime;
  583.     Ulong        ShutdownTime;
  584.     Ulong        test_start;
  585.     long        mscore;
  586.     Ulong        nbullets;
  587.     Ushort        ComVersion;
  588.     Ushort        nbuffers;
  589.     Ushort        maxbuffers;
  590.     Ushort        maxrecall;
  591.     Ushort        flags;
  592. #define    SF_BLANKER    0x0001
  593. #define    SF_LANDSCAPE    0x0002
  594. #define    SF_SKY        0x0004
  595. #define    SF_VERBOSE    0x0008
  596. #define    SF_INTERACTIVE    0x0010
  597. #define    SF_SIMULATING    0x0020
  598. #define    SF_INITED    0x0040
  599. #define    SF_PAUSED    0x0080
  600. #define    SF_LISTS    0x0f00
  601. #define    SF_MODES    0x0100
  602. #define    SF_HUD        0x0200
  603. #define    SF_HELP        0x0300
  604. #define    SF_NET         0x0400
  605. #define    SF_STATS    0x0500
  606. #define    SF_COLORS    0x0600
  607. #define SF_FONT        0x0700
  608. #define SF_PAUSEMSG    0x1000
  609. #define SF_DEBUG    0x2000
  610. #define SF_CLEARED    0x4000
  611. #define    SF_MAIN        0x8000
  612.     Ushort        flags1;
  613. #define    SF_USEG        0x0001
  614. #define    SF_WIDENT    0x0002
  615. #define    SF_DBUFFERING    0x0004
  616. #define    SF_TESTING    0x0008
  617. #define    SF_STEREOREV    0x0010
  618. #define    SF_EXTVIEW    0x0020
  619. #define    SF_IDENT    0x0040
  620. #define    SF_INFO        0x0080
  621. #define    SF_SMOKE    0x0100
  622. #define SF_TERM        0x0200
  623. #define    SF_HUDINFRONT    0x0400
  624. #define    SF_ASYNC    0x0800        /* asynchronous process active */
  625.     Ushort        sounds;
  626. #define    SS_WARN        0x0001
  627. #define    SS_ALARM    0x0002
  628.     Ushort        debug;
  629. #define DF_GPW        0x1000
  630. #define DF_GPX        0x2000
  631. #define DF_GPY        0x4000
  632. #define DF_GPZ        0x8000
  633.     Ushort        network;
  634. #define    NET_ON        0x0001
  635. #define    NET_NOBCAST    0x0002
  636. #define    NET_INITED    0x0004
  637. #define    NET_AUTOACCEPT    0x0010
  638. #define    NET_AUTODECLINE    0x0020
  639. #define    NET_AUTOCONNECT    0x0040
  640. #define    NET_AUTOREPLY    (NET_AUTOACCEPT|NET_AUTODECLINE|NET_AUTOCONNECT)
  641.     short        ntargets;
  642.     short        extview;
  643.     short        info;
  644.     short        stereo;        /* vision type */
  645. #define VIS_MONO        0
  646. #define VIS_STEREOSCOPIC    1
  647. #define VIS_REDBLUE        2
  648. #define VIS_ALTERNATING        3
  649.     short        windows;    /* windows configuration */
  650. #define WIN_TEXT    0
  651. #define WIN_FULL    1
  652. #define WIN_LANDSCAPE    2
  653. #define WIN_PORTRATE    3
  654. #define WIN_SQUARE    4
  655. #define WIN_WIDE    5
  656. #define WIN_PANORAMA    6
  657. #define WIN_ETHER    7
  658.     short        paralax;    /* stereo eye shift. MAX 100*VONE! */
  659.     short        focus;        /* stereo eye focus distance */
  660.     short        gap;        /* gap between stereo frames: 1/gap */
  661.     short        quiet;
  662.     OBJECT        *owner;
  663.     BUFFER        *bufs[NBUFS];    /* main window */
  664.     BUFFER        *buf[2];    /* current writable buffer */
  665.     BUFLINE        *buf_p;        /* current writable bufline */
  666.     short        buf_avail;    /* available entries in st.buf*/
  667.     short        which_buffer;
  668.     short        nobjects;
  669.     long        object_id;
  670.     OBJECT        *world[2];    /* all objects in world */
  671. #define CO    st.world[0]
  672. #define COT    st.world[1]
  673.     OBJECT        *land[2];    /* all objects in landscape */
  674. #define CL    st.land[0]
  675. #define CLT    st.land[1]
  676.     OBJECT        *viewer;    /* origin of view */
  677. #define CV    st.viewer
  678.     OBJECT        *control;    /* object under user control */
  679. #define CC    st.control
  680.     VIEW        view[1];    /* active view */
  681. #define CVIEW    st.view
  682. #define CP    st.view->viewport
  683. #define CW    st.view->window
  684. #define CS    st.view->screen
  685. #define NHDD    10
  686.     HDD        hdd[NHDD];    /* HDD windows */
  687.     int        interval;    /* milliseconds of last frame */
  688.     int        dither;        /* rand () % 1000 */
  689.     POINTER        *pointer;    /* kludge for oplane.c */
  690.     int        StFont;
  691.     Uchar    NEAR* NEAR* StFontPtr;    /* StFonts[StFont] */
  692.     int        StFontSize;
  693.     int        landx;        /* land square: x and y */
  694.     int        landy;
  695.     int        gravity;    /* meters/sec/sec */
  696.     HMSG        *msg;        /* message queue */
  697.     int        drones;        /* number of drones */
  698.     int        killers;    /* how many drones are killers */
  699.     int        SkyLines;    /* number of lines in sky */
  700.     short        home;        /* home base nav point */
  701.     Ushort        btnmode;    /* buttons shift mode */
  702.     short        nMacros;    /* max number of keyboard macros */
  703.     long        lineno;
  704. #define NCOLORS    16
  705.     Ushort        colors[NCOLORS];
  706.     Ulong        palette[NCOLORS];
  707.     Ushort        assign[32];
  708. #define CA_IFG        0
  709. #define CA_MFG        1
  710. #define CA_WFG        2
  711. #define CA_CFG        3
  712. #define CA_HFG        4
  713. #define CA_HFGI        5
  714. #define CA_HBO        6
  715. #define CA_SLEFT    7
  716. #define CA_SRIGHT    8
  717. #define CA_SBOTH    9
  718. #define CA_GROUND    10
  719. #define CA_DULL        11
  720. #define CA_FAINT    12
  721. #define CA_SKY        13
  722. #define CA_FRIEND    14
  723. #define CA_FOE        15
  724. #define CA_HELP        16
  725. #define CA_FIRE1    17
  726. #define CA_FIRE2    18
  727. #define CA_MENU        19
  728. #define CA_MENUH    20
  729. #define ST_INFO        st.assign[CA_IFG]
  730. #define ST_MFG        st.assign[CA_MFG]
  731. #define ST_WFG        st.assign[CA_WFG]
  732. #define ST_CFG        st.assign[CA_CFG]
  733. #define ST_HFG        st.assign[CA_HFG]
  734. #define ST_HFGI        st.assign[CA_HFGI]
  735. #define ST_HBO        st.assign[CA_HBO]
  736. #define ST_SLEFT    st.assign[CA_SLEFT]
  737. #define ST_SRIGHT    st.assign[CA_SRIGHT]
  738. #define ST_SBOTH    st.assign[CA_SBOTH]
  739. #define ST_GROUND    st.assign[CA_GROUND]
  740. #define ST_DULL        st.assign[CA_DULL]
  741. #define ST_FAINT    st.assign[CA_FAINT]
  742. #define ST_SKY        st.assign[CA_SKY]
  743. #define ST_FRIEND    st.assign[CA_FRIEND]
  744. #define ST_FOE        st.assign[CA_FOE]
  745. #define ST_HELP        st.assign[CA_HELP]
  746. #define ST_FIRE1    st.assign[CA_FIRE1]
  747. #define ST_FIRE2    st.assign[CA_FIRE2]
  748. #define ST_MENU        st.assign[CA_MENU]
  749. #define ST_MENUH    st.assign[CA_MENUH]
  750.  
  751.     PLAYER NEAR    *all_known;    /* for remote_* () usage */
  752.     PLAYER NEAR    *all_active;    /* -"- */
  753.     PLAYER NEAR    *all_team;    /* -"- */
  754.     PLAYER NEAR    *all_ports;    /* -"- */
  755.     PLAYER NEAR    *all_pports;    /* -"- */
  756.     PLAYER NEAR    *all_players;    /* internal to menus.c */
  757.     PLAYER NEAR    *no_players;    /* -"- */
  758.     int        misc[20];
  759.     long        stats[100];
  760.     char        filename[1024];    /* file name work area */
  761. };
  762.  
  763. #define Sys    st.system
  764. #define Tm    st.time
  765. #define Gr    st.graphics
  766. #define Snd    st.sound
  767. #define Kbd    st.keyboard
  768.  
  769. #define GACC    st.gravity
  770.  
  771. #define VP    view->viewport
  772. #define VW    view->window
  773. #define VS    view->screen
  774.  
  775. struct FldTab {
  776.     int    type;
  777.     void    *p;
  778. };
  779.  
  780. struct hud {
  781.     short    flags;
  782. #define HF_ETHER    0x0001    /* this is an ether display/HUD */
  783. #define HF_ETHERFRAME    0x0002    /* use ether style frame indicators */
  784.     short    orgx;        /* window center */
  785.     short    orgy;
  786.     short    maxx;        /* window size */
  787.     short    maxy;
  788.     short    shifty;        /* hud down shift */
  789.     short    cx;        /* hud center */
  790.     short    cy;
  791.     short    sx;        /* hud size */
  792.     short    sy;
  793.     short    clipx;
  794.     short    clipy;
  795.     short    clipr;        /* bounding rectangle (relative) */
  796.     short    clipl;
  797.     short    clipt;
  798.     short    clipb;
  799.     short    right;        /* bounding rectangle (absolute) */
  800.     short    left;
  801.     short    top;
  802.     short    bottom;
  803.     short    tx;        /* tick size */
  804.     short    ty;
  805.     short    ttx;        /* 'big' adjusted tick size */
  806.     short    tty;
  807.     short    ss;        /* stroke size */
  808.     short    dd;        /* digit width */
  809.     ANGLE    width;        /* horizontal aperture */
  810.     ANGLE    height;        /* vertical aperture */
  811.     Ushort    fg;        /* color (normal) */
  812.     Ushort    fgi;        /* color (intensified) */
  813.     int    VV[2];        /* vv position */
  814.     short    etherx;        /* ether frame x centerline */
  815.     short    ethery;        /* ether frame y centerline */
  816.     short    ethertx;    /* ether frame x half-width */
  817.     short    etherty;    /* ether frame y half-width */
  818.     short    misc[10];
  819. };
  820. typedef struct hud HUD;
  821.  
  822. struct ils {
  823.     char    *name;
  824.     LVECT    R;        /* runway position */
  825.     short    longitude;
  826.     short    latitude;
  827.     short    l[2];        /* localizer relative x/y */
  828.     short    g[2];        /* glide-path relative x/y */
  829.     ANGLE    localizer;    /* heading of forward beam */
  830.     ANGLE    glidepath;    /* pitch of beam */
  831. };
  832.  
  833. #include "extern.h"
  834.  
  835. #endif
  836.